const TokenKey = "admin_user_token"
const ToKeyExpireKey = "admin_user_token_expire"
//获取token
export function getToken() {
    let token = localStorage.getItem(TokenKey);
    if(token){
        if(new Date().getTime() > localStorage.getItem(ToKeyExpireKey)){
            removeToken();
            token = null;
        }
    }
  return token;
}

//设置token
export function setToken(token) {
    localStorage.setItem(TokenKey, token);
    localStorage.setItem(ToKeyExpireKey, new Date().getTime() + 1000*60*60);
    //设置一个过期时间  1小时
}
//移除token
export function removeToken() {
    localStorage.removeItem(TokenKey);
    localStorage.removeItem(ToKeyExpireKey);
}